<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      body {
        height: 3000px;
      }
      .box {
        width: 200px;
        height: 200px;
      }
      .box:nth-child(1) {
        background-color: red;
      }
      section {
        position: relative;
      }
      section > div {
        width: 200px;
        height: 200px;
        background-color: green;
        position: absolute;
      }
      .box:nth-child(3) {
        background-color: blue;
        /* position: fixed; */
        position: sticky;
        top: 10px;
      }
    </style>
  </head>
  <body>
    <div class="box"></div>
    <section>
      <div></div>
    </section>
    <div class="box"></div>
  </body>
</html>
